package com.xjrsoft.common;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Copyright(C),2020-2022,浙邮科技
 * FileName:TestBean
 * Author:ani
 * Date:2022/5/23 14:31
 * Description:
 * History:
 * <author>   <time>      <version>   <desc>
 * 作者姓名   修改时间    版本号      描述
 */
@Component("testBean")
public class TestBean {
    /**
     * 方法必须包含三个参数：String，String，Map
     * @return 集合类型 ，包含字段：id,name,salary
     */
    public List<Map<String, Object>> loadReportData(String dsName, String datasetName, Map<String, Object> parameters) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        for (int i = 0; i < 1000; i++) {
            // 模拟数据
            Map<String, Object> m = new HashMap<String, Object>();
            m.put("id", i);
            m.put("name", RandomStringUtils.random(10, true, false));
            m.put("salary", RandomUtils.nextInt() + i);
            list.add(m);
        }
        return list;
    }
}
